amd/msr: allow passthrough of VIRT_SPEC_CTRL for HVM guests
authorRoger Pau Monné <roger.pau@citrix.com>
Mon, 15 Aug 2022 07:58:08 +0000 (09:58 +0200)
committerGeorge Dunlap <george.dunlap@citrix.com>
Fri, 19 Aug 2022 19:23:21 +0000 (20:23 +0100)
commit15f3a67e7e05d268dee24337e1688ea6675a5036
treec736724aa097ed93fa653bff0e4333639f27d560
parent8ffd5496f46425f73771200f2b51087b794be553
amd/msr: allow passthrough of VIRT_SPEC_CTRL for HVM guests

Allow HVM guests access to MSR_VIRT_SPEC_CTRL if the platform Xen is
running on has support for it.  This requires adding logic in the
vm{entry,exit} paths for SVM in order to context switch between the
hypervisor value and the guest one.  The added handlers for context
switch will also be used for the legacy SSBD support.

Introduce a new synthetic feature leaf (X86_FEATURE_VIRT_SC_MSR_HVM)
to signal whether VIRT_SPEC_CTRL needs to be handled on guest
vm{entry,exit}.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Re-commited with a tag removed.

Signed-off-by: George Dunlap <george.dunlap@citrix.com>
xen/arch/x86/cpuid.c
xen/arch/x86/hvm/svm/entry.S
xen/arch/x86/hvm/svm/svm.c
xen/arch/x86/include/asm/cpufeatures.h
xen/arch/x86/include/asm/msr.h
xen/arch/x86/msr.c
xen/arch/x86/spec_ctrl.c